/**
 * 防抖
 * @param method
 * @param delay
 * @returns {Function}
 */
let debounce = (method, delay) => {
  var timer = null
  return function () {
    var context = this
    var args = arguments
    // 再次进入，清除上一个timer
    clearTimeout(timer)
    
    timer = setTimeout(function () {
      // 执行加1
      method.apply(context, args)
    }, delay)
  }
}

export default debounce
